Useful information can be encoded in printed images referred to generically as barcodes. Such a bar code can include a two dimensional data matrix made up of a grid of black and white patches. Other barcodes, such as a color mosaic, are three dimensional. A three-dimensional data matrix can be made up from a grid of patches with each patch having a color (the third dimension) selected from a predetermined palette. Information identifying a product can be encoded in such barcodes printed on packaging of a consumer good. The bar code can be scanned at a location such as a warehouse, point of sale, or repair facility to identify the product and other relevant information. In various applications, it may be desirable to scramble the patches in a barcode such as a data matrix to protect or conceal the information encoded.